﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using GKBErps.BLL.sys;
using GKBErps.Common;
using GKBErps.Model;
using GKBErps.Model.dto;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;

namespace GKBErps.Web.Areas.System.Controllers
{
    [Area(nameof(System))]
    [Route("System/[controller]/[action]")]
    public class MenuController : Controller
    {
        sys_menuBLL sys_MenuBLL = new sys_menuBLL();
        public IActionResult Index()
        {
            return View();
        }

        public ActionResult GetMenuList(string name,string isActive) {
            if (string.IsNullOrEmpty(name)) {
                name = "";
            }
            if (string.IsNullOrEmpty(isActive)) {
                isActive = "-1";
            }
             List<sys_menu> sys_Menus = sys_MenuBLL.GetList(name,isActive);
            object jsonResult = new
            {
                code = 0 ,
                data = sys_Menus
            };
            var jsonstr = JsonConvert.SerializeObject(jsonResult);
            return Content(jsonstr);
        }
    }
}
